<template>
	<view>
		<view class="content f-dc" style="background-color: #fff;">
			<view class="nav">
				<up-navbar title="查阅审批流" :fixed="false" :autoBack="false" leftIconColor="#fff"
					@leftClick="closeApprovePopup">
				</up-navbar>
			</view>

			<scroll-view class="scroll-Y content_main" style="width: 100%;" :scroll-y="true"
				:style="{height:scrollViewHeight+'px'}">
				<mApproveList :option="BaseScreenParm" @openPreview="openPreview"></mApproveList>
			</scroll-view>
		</view>

	</view>
</template>

<script setup lang="ts">
	import { ref, reactive } from 'vue';
	import { onLoad, onUnload } from "@dcloudio/uni-app";
	import { useMainStore, useInventoryStore } from '@/store';
	const inventoryStore = useInventoryStore();
	const mainStore = useMainStore();
	import mApproveList from '@/uni_modules/mc-ui/components/m-node-warp/components/m-approve-list/m-approve-list.vue';


	const pages = getCurrentPages()
	const currentPage = pages[pages.length - 1] as any;
	const eventChannel = currentPage.getOpenerEventChannel();

	let BaseScreenParm = reactive<any>({});

	Object.assign(BaseScreenParm, mainStore.BaseScreenParm);
	const { windowHeight } = uni.$utils.getWindowInfo();
	let scrollViewHeight = ref(windowHeight * 0.8);

	async function getScrollHeight() {
		uni.createSelectorQuery().select('.nav').boundingClientRect((nav : any) => {
			scrollViewHeight.value = windowHeight - nav.height;
		}).exec();


	}

	function closeApprovePopup(type = 'cancel', data : any = null) {
		hide(type, data);
	};
	function hide(type : any, data = null) {
		inventoryStore.st_comPageConfig.showFormApprove = true;
		setTimeout(() => {
			inventoryStore.st_comPageConfig.showFormApprove = false;
			uni.navigateBack({
				delta: 1,
				success() {
					eventChannel.emit(type, data);
				}
			})
		}, 100);
	}

	function openPreview() {

	};
	onUnload(() => {
		eventChannel.emit('cancel');
	})
</script>

<style lang="scss">

</style>